<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Priithon.ArrayIO</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="Priithon-module.html">Package&nbsp;Priithon</a> ::
        Module&nbsp;ArrayIO
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="Priithon.ArrayIO-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module ArrayIO</h1><p class="nomargin-top"><span class="codelink"><a href="Priithon.ArrayIO-pysrc.html">source&nbsp;code</a></span></p>
<pre class="literalblock">
This module contains elementary support for I/O of one- and
two-dimensional numerical arrays to and from plain text files. The
text file format is very simple and used by many other programs as
well:

- each line corresponds to one row of the array

- the numbers within a line are separated by white space

- lines starting with # are ignored (comment lines)

An array containing only one line or one column is returned as a
one-dimensional array on reading. One-dimensional arrays are written
as one item per line.

Numbers in files to be read must conform to Python/C syntax.  For
reading files containing Fortran-style double-precision numbers
(exponent prefixed by D), use the module Scientific.IO.FortranFormat.

</pre>

<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Functions</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Functions"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.ArrayIO-module.html#readArray" class="summary-sig-name">readArray</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">comment</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default">None</span>)</span><br />
      Return an array containing the data from file |filename|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readArray">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.ArrayIO-module.html#readArray_conv" class="summary-sig-name">readArray_conv</a>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">fn</span>,
        <span class="summary-sig-arg">comment</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">dtype</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default">None</span>)</span><br />
      Return an array containing the data from file |filename|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readArray_conv">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="readFloatArray"></a><span class="summary-sig-name">readFloatArray</span>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">dtype</span>=<span class="summary-sig-default">&lt;type 'numpy.float64'&gt;</span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default">None</span>)</span><br />
      Return a floating-point array containing the data from file 
      |filename|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readFloatArray">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="readIntegerArray"></a><span class="summary-sig-name">readIntegerArray</span>(<span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">dtype</span>=<span class="summary-sig-default">&lt;type 'numpy.int32'&gt;</span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default">None</span>)</span><br />
      Return an integer array containing the data from file |filename|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readIntegerArray">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.ArrayIO-module.html#writeArray" class="summary-sig-name">writeArray</a>(<span class="summary-sig-arg">array</span>,
        <span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">mode</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">w</code><code class="variable-quote">'</code></span>,
        <span class="summary-sig-arg">sep</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"> </code><code class="variable-quote">'</code></span>)</span><br />
      Write array |a| to file |filename|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#writeArray">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="Priithon.ArrayIO-module.html#writeDataSets" class="summary-sig-name">writeDataSets</a>(<span class="summary-sig-arg">datasets</span>,
        <span class="summary-sig-arg">filename</span>,
        <span class="summary-sig-arg">separator</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span><br />
      Write each of the items in the sequence |datasets| to the file 
      |filename|, separating the datasets by a line containing |separator|.</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#writeDataSets">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Function Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-FunctionDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="readArray"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">readArray</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">comment</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">sep</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readArray">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return an array containing the data from file |filename|. This 
  function works for arbitrary data types (every array element can be given
  by an arbitrary Python expression), but at the price of being slow. For 
  large arrays, use readFloatArray or readIntegerArray if possible.</p>
  <p>ignore all lines that start with any character contained in 
  comment</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="readArray_conv"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">readArray_conv</span>(<span class="sig-arg">filename</span>,
        <span class="sig-arg">fn</span>,
        <span class="sig-arg">comment</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">#</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">dtype</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">sep</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#readArray_conv">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Return an array containing the data from file |filename|. This 
  function works for arbitrary data types (every array element can be given
  by an arbitrary Python expression), but at the price of being slow.</p>
  <p>fn is called for each &quot;cell&quot; value. if dtype is None, uses 
  &quot;minimum type&quot; (ref. Numpy doc) if sep is None, any white space
  is seen as field separator ignore all lines that start with any character
  contained in comment</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="writeArray"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">writeArray</span>(<span class="sig-arg">array</span>,
        <span class="sig-arg">filename</span>,
        <span class="sig-arg">mode</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">w</code><code class="variable-quote">'</code></span>,
        <span class="sig-arg">sep</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"> </code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#writeArray">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Write array |a| to file |filename|. |mode| can be 'w' (new file) or 
  'a' (append).</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<a name="writeDataSets"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">writeDataSets</span>(<span class="sig-arg">datasets</span>,
        <span class="sig-arg">filename</span>,
        <span class="sig-arg">separator</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string"></code><code class="variable-quote">'</code></span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="Priithon.ArrayIO-pysrc.html#writeDataSets">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Write each of the items in the sequence |datasets| to the file 
  |filename|, separating the datasets by a line containing |separator|. The
  items in the data sets can be one- or two-dimensional arrays or 
  equivalent nested sequences. The output file format is understood by many
  plot programs.</p>
  <dl class="fields">
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="Priithon-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/priithon">Priithon</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Mon Nov 22 14:59:32 2010
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
